package cn.jsj.dispose;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.jsj.object.FrontAdminInfo;
import cn.jsj.object.FrontLawyer;
import cn.jsj.utils.ProduceJsonData;
import cn.jsj.utils.SysLogger;

 public class SearchAdminPersonInfo extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {

	 public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		//调试信息
		cn.jsj.utils.SysLogger.PrintInfo("进入查询行政人员信息");

		//获取参数: 行政人员名字
		String adminPerName=request.getParameter("adminPerName").trim();
		adminPerName=new String(adminPerName.getBytes("ISO-8859-1"),"UTF-8");

		//获得限定条件 从第几条开始，一页显示几条
		int startNumb=Integer.parseInt(request.getParameter("start"));
		int totalNumb=Integer.parseInt(request.getParameter("limit"));

		//调试信息
		cn.jsj.utils.SysLogger.PrintInfo("获得的参数为--->"+adminPerName+startNumb+totalNumb);

		//新建行政人员操作对象
		cn.jsj.dao.TblAdminPersonnelDAO tapd=new cn.jsj.dao.TblAdminPersonnelDAO();
		//获得符合条件的行政人员信息（要么只有一条要么没有）
		cn.jsj.pojo.TblAdminPersonnel tap=tapd.getAdminFromName(adminPerName);


		//改造成前台需要的行政人员信息对象
		cn.jsj.object.rebuild.AdminInfoRebuild air=new cn.jsj.object.rebuild.AdminInfoRebuild();
		FrontAdminInfo frontAdminInfo=air.rebuildAdmin(tap);

		//前台律师信息对象队列
		java.util.List<FrontAdminInfo> frontAdminInfoList=new java.util.LinkedList<FrontAdminInfo>();
		frontAdminInfoList.add(frontAdminInfo);
		//改造成JSON型数据
		ProduceJsonData pjd=new ProduceJsonData();
		String resultData=	pjd.jsonFromList(frontAdminInfoList,1);

		//调试信息
		SysLogger.PrintInfo(resultData);
		//输出到客户端
		java.io.PrintWriter pw=response.getWriter();
		pw.println(resultData);
		pw.flush();

	}

	 public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request,response);
	}
}